package com.j.lemon.learn.asiainfo;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.concurrent.BlockingQueue;

/**
 * @Author lijunjun
 * @Date 2020-06-11 15:33
 * @Description
 */
public class UdpSend1 {

    public static void main(String[] args) throws IOException {
        // 创建数据包对象，封装要发送的数据，接收端IP，端口
        byte[] date = "<85>tacplus: optTime=20200918105122,sessionId=1600397482,sessionIdPa=,pracct=UNI_config,slacct=,srcIP=203.119.113.151,srcMAC=,srcHost=,dstIP=61.187.97.72,dstPort=49,dstName=,dstId=,dstHost=,oper=cmd,operProtocol=ip,operDir=,result=0,despCmd=dis logb level 2  | include \"Sep 17.*%%01[^S][^O][^C][^K][^E][^T]\",errMsg=,workOrder=,workOrderType=,fromSys=HOST\n".getBytes();
        //创建InetAdress对象，封装自己的IP地址
        InetAddress inet = InetAddress.getByName("10.21.171.181");
        {
            DatagramPacket dp = new DatagramPacket(date, date.length, inet,6667);
            //创建DatagramSocket对象，数据包的发送和接收对象
            DatagramSocket ds = new DatagramSocket();
            //调用ds对象的方法send，发送数据包
            ds.send(dp);
            ds.close();
        }
    }
}
